home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Night Owl 6
/
Night Owl's Shareware - PDSI-006 - Night Owl Corp (1990).iso
/
019a
/
xe20.zip
/
XE.DOC
next >
Wrap
Text File
|
1991-09-25
|
22KB
|
492 lines
≡■≡ heXEdit ≡■≡
Version 2.0
9-25-91
Robert Stuntz
1747 Crystal Lane #610
Mt. Prospect, IL. 60056
GEnie : R.STUNTZ
DISCLAIMER
THIS SOFTWARE AND MANUAL ARE DISTRIBUTED "AS IS" AND WITHOUT
WARRANTIES AS TO PERFORMANCE OF MERCHANTABILITY OR ANY OTHER
WARRANTIES WHETHER EXPRESSED OR IMPLIED. BECAUSE OF THE VARIOUS
HARDWARE AND SOFTWARE ENVIRONMENTS INTO WHICH THIS PROGRAM MAY BE
PUT, NO WARRANTY OF FITNESS FOR A PARTICULAR PURPOSE IS OFFERED AND
ALL LIABILITY IN THE USE AND AFFECTS OF THIS PROGRAM SHALL REST
WITH THE USER.
≡■≡ Introduction
heXEdit (XE) is a program that will allow you to
display and/or edit any file. It has few and simple commands
but serves my purposes perfectly. I wrote this program because
I became frustrated with a couple of other commercial programs.
They either had some annoying peculiarities or required too
much thought on my part just to search for and change a couple
of bytes.
heXEdit was written using Turbo Pascal v6.0, although
it doesn't use any of Borland's object libraries. It does
however write directly to the screen for speed when scrolling
thru the file. If you're using a CGA monitor you may see some
'snow' as I don't check for the vertical retrace period to
write to the screen.
When heXEdit starts it looks for a configuration file
that defines the colors to be used. The name of the file is
'XE.CFG'. XE first looks in the current directory for the file.
If it doesn't find it there it checks the environment for a
variable named 'XE' and looks in the path specified by that
variable. (See your DOS manual for an explanation of
environment variables). If XE doesn't find it there it then
looks in the directory that XE.EXE is in.
The environment variable 'XE' can be set by using the
DOS SET command. You should include the full path, just so
there is no confusion as to what drive the file is on. For
example :
SET XE=C:\UTIL\
Also, the last back-quote character should be included as I
just append the filename to the path you specify. If you do
use an environment variable but XE can't find the file there,
it will look in the same directory that XE.EXE is in. If you
don't use the configuration file in the first place, XE will
use a default set of colors.
heXEdit will keep no more than 1760 bytes of the file
in memory at a time, as I didn't feel like messing with a
variable amount of memory available. heXEdit only requires
about 83k bytes of free memory in order to execute.
≡■≡ Using heXEdit
To start heXEdit, enter
XE [drive | filename]
The drive designator and filename are optional on the
command line. If only a drive letter is specified XE will
change your current directory to that drive and show you the
files from the root directory of that drive. If a file is
specified XE will try to load that file, if not, the Loadfile
box will appear with a list of files in the current directory.
With the Loadfile box you can use the Up/Down arrow keys,
PgUp/PgDn and the Home/End keys to move the highlight bar to
the file you want to load. The Up/Down arrow keys will move
the bar one file at a time. PgUp/PgDn move the bar a page at a
time, and Home/End will move the bar to the beginning/end of
the list of files.
With the highlight bar over the file you want to load,
just hit <ENTER> to load the file. If there is an error trying
to load the file an error message will pop up giving you four
options.
Option 1 - (A)bort : if you press 'A' XE will abort the
operation.
Option 2 - (R)etry : press 'R' to retry the operation. (Maybe
the drive door was opened before you hit <ENTER> to load the
file.)
Option 3 - (Q)uit XE : quit XE and return to the DOS prompt (or
wherever it was that you came from).
Option 4 - Any other key : if you hit any other key than the
ones described above you will be returned to the Loadfile box.
While in the Loadfile box, hitting <ESC> will exit the
Loadfile box and either 1) return you to the last file you were
editing, or if no file was previously loaded 2) exit XE altogether.
One last feature of the Loadfile box is that you can change
the attributes of a file simply by hitting F5-F8 (providing the
file is available; i.e., the disk is in the drive etc.) Move
the highlight bar to file you want to work with and then simply
hit one of the following, depending on what you want to do.
F5 - toggles the Archive bit
F6 - toggles the System bit
F7 - toggles the Hidden bit
F8 - toggles the Read_Only bit
If the attribute change was successful you will hear a high
pitch tone otherwise you will hear a lower tone indicating that
the attribute could not be changed for one reason or another.
Once the file is loaded you will see the main display.
At the top is the name of the file loaded. On the left side of the
display are numbers (in hexadecimal,decimal or octal)
indicating the offset into the file. In the middle are 22 rows
of 16 bytes each which are the file's contents. On the right,
the ASCII character for each byte in that row. In the ASCII
portion of the display, any characters past the EOF are shown
as a '.' (#249). On the bottom is a status word indicating your
current operation, the size of the file in decimal, and whether
the offset display is in 'hex'adecimal, 'dec'imal, or 'oct'al.
≡■≡ Commands
Following is a list of commands once you are in XE and then a
brief explanation of each :
F1- Help
A - ASCII table
E - Edit the file
S - Search (for text or a byte string)
N - Search again (using the last used search string)
L - Load a new file
C - Change colors (and/or save a configuration file for colors)
B - Base conversion (decimal-hexadecimal-binary)
D - Change offset display to Decimal
H - Change offset display to Hexadecimal
O - Change offset display to Octal
G - Goto offset
M - Push position on marker stack
R - Retrieve position from marker stack
Z - Clear all entries from marker stack
Up/Down arrow keys - scroll up and down one line at a time
PgDn/PgUp - move up/down one page at a time
Home - move the beginning of the file
End - move to the end of the file
ESC/Alt-X - quit XE
■-- F1: Display a simple help screen of commands. Hit any key
to exit the help screen.
■-- A : This displays an ASCII chart.
ASCII chart commands :
- Left arrow key : go back 16 characters
- Right arrow key : go forward 16 characters
- PageUp : go back 128 characters
- PageDown : go forward 128 characters
- D : display numbers in decimal
- H : display numbers in hexadecimal
- ESC or Enter : exits ASCII chart
■-- E : Begin editing the file at the current position.
Edit commands :
- BackSpace/Left arrow key : move cursor left 1 byte
- Right arrow key : move cursor right 1 byte
- PageUp : move cursor to first byte on page
- PageDown : move cursor to last byte on page
- Home : move cursor to beginning of line
- End : move cursor to end of line
- TAB : toggle cursor position between the
hexadecimal display and the ASCII display of the
file. The above editing commands will move the
cursor within the area the cursor is in.
You can edit the file making changes in both
areas at the same time, if so desired.
- ESC/Enter : quit editing. If you made changes
you will be prompted to save the changes or not.
Hit 'Y' to save the changes or 'N' to lose the
changes. Only the portion of the file that is in
memory is actually saved. So don't worry about
waiting for a long save if you are editing a
large file. You are then returned to the View
mode.
To change a value when in the hexadecimal portion, just
type in it's new value. The background of the character
will change, indicating which bytes have been changed.
Valid values are '00' - 'FF'. Obviously, hitting a key
like 'P' will do nothing because 'P' is not a valid
hexadecimal character. A special note, once you change
the left half of the byte, you must continue and change
the right half also.
To change a value when in the ASCII portion of the
display, simply hit the key of the new value. Again,
the background will change indicating a change.
Note - When in edit mode you will be able to change the
characters after the EOF. It will look like you are
changing the file but in reality nothing will be
changed. You cannot increase the size of the file,
only change what already exists. (A small price
to pay for making the coding easier on me!)
■-- S : Search the file for a byte or text sequence.
You will be prompted for the type of search 1) Byte or
2) Text.
For a byte sequence, enter the bytes then hit Enter. As
with editing, you must enter a complete byte, although
I don't check for that here. You can use the backspace
key to go back and make corrections. The maximum length
for a byte sequence is 9 bytes. I think that is plenty
long enough, even 4 bytes would probably be enough to
find what you're looking for.
For a text sequence, just type in the text to search
for, no quotes are needed, and hit Enter. The maximum
length for a text sequence is 25 characters. And a
change from my earlier versions, the search is now case
insensitive.
If the search string is found, the display will move to
that string's location in the file and will be high-
lighted at the top of the screen. You can now hit any
key to continue the search, hit 'M' to Mark the
position or hit ESC to stop searching.
Just to make things simple for myself, every search
starts at the beginning of the file. Even on large
files, starting at the beginning to find something you
know is near the end doesn't take very long at all (at
least not on my 16 Mhz 386sx!)
■-- N : Search again using the last used search string. If
there is no previous search string, you will be
prompted, as if you hit 'S', to enter a search string.
■-- L : Load a new file. You will enter the Loadfile box in
order to select a new file (as described earlier in
this document under ≡■≡ Using heXEdit).
Since you can't leave the edit mode without either
saving any changes or losing changes, you needn't worry
about saving the current file before loading a new one.
■-- C : This command will allow you to change the color of just
about anything. Of course, if you're using a monochrome
monitor this command will do nothing. You can also save
a color configuration file if you like, so that XE will
startup with the colors you like.
I didn't do anything fancy here. Simply select the area
you want to change the color in by hitting a letter 'A'
thru 'W' (with the exception of 'S'). Then enter the
number corresponding to the color you want.
Color change commands:
■- A - W : select the area you want to change (except 'S')
■- ESC/Enter : exit the color change screen
■- S : save a configuration file with the currently
selected colors
This command will save a file named 'XE.CFG'
that defines the colors for XE to use. The file
is saved in the same place it was found. If
this is the first time this file has existed,
it will be saved in the current directory.
■-- B : Convert a number from either decimal, hexadecimal or
binary to the other two.
Base convert commands :
■- Up/Down arrow keys : select the base of the input
number
■- Enter : convert the number
■- ESC : exit the base convert routine
Using the arrow keys, move the highlight bar to the
base of the input number and then either 1) hit Enter
and enter the number or 2) just start typing the
number. After the number has been converted, hit any
key to select the base for another conversion or hit
ESC to exit.
When you enter the number, I only check for validity
with the first character. If you try to convert an
invalid number an error message will be displayed. The
largest number that can be accurately converted is a 32
bit number. It has a very simple input routine, so
don't be surprised if you can enter an invalid number.
The conversion will be incorrect of course. I leave
it mostly up to you to enter a valid number.
■-- D : Change the offset display to base 10, decimal.
■-- H : Change the offset display to base 16, hexadecimal.
■-- O : Change the offset display to base 8, octal.
■-- G : Goto an offset in the file.
You are prompted for an offset to go to. You can enter
either a decimal number or a hexadecimal number. If you
hit ESC while entering a number you will be placed back
in the View mode with no repositioning taking place.
The BACKSPACE key can be used to edit your entry. If
you enter an offset that is beyond the End-Of-File
(or < 0) you will be prompted again for a number.
To enter a decimal number just type in the number, no
commas, and hit ENTER.
To enter a hexadecimal number, type a '$' as the first
character and then continue entering the hex number.
Also, if at anytime while entering a number, you enter
an 'A' through 'F' a '$' will be inserted into your
number at the beginning and your entry will be taken as
a hexadecimal number. For example:
Keystroke Screen
3 3
5 35
1 351
E $351E
etc ...
■-- M : Push position on marker stack.
Your current position in the file can be saved with
this command and then be retrieved later on.
Your position is saved on a stack. If the stack is full
the oldest position will be deleted and the rest of the
entries will move down the stack to make room for the
new entry. The maximum number of positions you can save
is 100. Also, when your position is saved, it's location
on the stack is reported to you so you can see how full
the marker stack is.
This command can also be used while searching. If the
search string is found, you can hit 'M' to save that
position on the marker stack and then continue searching.
■-- R : Goto position using the top marker stack entry.
While viewing the file, if you hit this command you
will be moved to the location specified by the top
marker stack entry. Once you have been moved to the new
location, the entry you retrieved will be deleted
from the marker stack. If there are no markers on the
stack, then nothing will happen.
■-- Z : Clear all entries from marker stack
This command will delete all entries from the marker
stack. Careful, there is no turning back from the
results of this command.
≡■≡ Comments
I would strongly suggest that you make a backup copy of the
file you're going to modify, just in case you decide later
you want the original file back. You should have a backup copy
anyway as a matter of safeguarding your files in case of
catastrophe.
I have a 16Mhz 386sx AT running MS-DOS 5.0. XE should work
with most system configurations though. It does not support
any video modes other than 80x25 text and will work with a
monochrome monitor.
Also, I don't expect any payment for use of this program. Feel
FREE to use it how you like, but be careful.
I would like to hear any comments or complaints you might
have about this program. I can be reached on GEnie under
R.STUNTZ, or on The Chicago Megaphile BBS (312 283-4035) under
ROB STUNTZ. Or if you prefer, the good ole' U.S. Postal
Service.
Rob
≡■≡ Version History
v1.0 4-8-91 - Initial writing
v1.1 5-16-91 - Minor internal changes
v1.2 7-4-91 - added Marker commands
v1.21 8-3-91 - increased marker stack size to 100
added Z command; clear marker stack
v1.3 8-12-91 - added Goto Offset command
fixed a bug or two
v2.0 9-25-91 - added Loadfile box (instead of typing in
the filename)
set to video page 0 at startup
(this was done in case you shell out from
another program and that program puts you
in a video page other than 0, like Turbo
Debugger. XE needs to be in video page
0. XE returns to the video page you
where at before it started when you exit)
added backspace key use while editing (acts
like left arrow key)
added 'D', 'H' and 'O' commands while viewing
changed Help command to 'F1' from 'H'
made Search command case insensitive
added ability to enter a drive designator
on cmd line to start Loadfile box on that drive
and of course fixed some bugs ...
≡■≡
'Turbo Pascal' and 'Turbo Debugger' are registered trademarks
of Borland International, Inc.